import { createRouter, createWebHistory } from 'vue-router'
//制定路由规则
const routes = [
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/Login.vue'),
  },
  {
    path: '/',
    name: 'main',
    component: () => import('@/components/Main.vue'),
    // 默认到home
    // redirect:'/login',
    children: [],
  },
  {
    path: '/form',
    name: 'form',
    component: () => import('@/views/Form.vue'),
  },
  {
    path: '/404',
    name: '404',
    component: () => import('@/views/404.vue'),
  },
]

const router = createRouter({
  //设置路由模式
  history: createWebHistory(), //路径 http://localhost:5173/login
  // history: createWebHashHistory(), // 路径中 http://localhost:5173/#/login
  routes,
})
export default router
